﻿namespace Sample.JQuery {
	using System.Web.UI;

	public partial class StandardMasterPage : MasterPage {

		protected override void OnLoad(System.EventArgs e) {
			base.OnLoad(e);

			string title = Page.Title;
			Page.Title = HomeLink.Text + " : " + title;
			TitleHeader.InnerText = title;

			Page.MaintainScrollPositionOnPostBack = true;

			ThemeDropdown.SelectedIndexChanged += new System.EventHandler(ThemeDropdown_SelectedIndexChanged);
		}

		protected override void OnPreRender(System.EventArgs e) {

			string theme = Session["Theme"] as string;
			if(!string.IsNullOrEmpty(theme)) ThemeDropdown.SelectedValue = JQueryManager.Theme = theme;

			base.OnPreRender(e);
		}

		private void ThemeDropdown_SelectedIndexChanged(object sender, System.EventArgs e) {
			Session["Theme"] = JQueryManager.Theme = ThemeDropdown.SelectedValue;
		}

	}

}